Re: [SQL] Getting primary key from insert statement

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [SQL] Getting primary key from insert statement
Дата
Msg-id l03130300b3812492cf77@[147.233.159.109]
обсуждение исходный текст
Ответ на Re: [SQL] Getting primary key from insert statement  ("Emils Klotins" <emils@mail.usis.bkc.lv>)
Список pgsql-sql
At 12:51 +0300 on 07/06/1999, Emils Klotins wrote:


>
> Wouldn't it be simpler just to SELECT the next value from the sequence
>BEFORE the insert and
> use it in the INSERT statement directly?

Then you have to have a transaction around the two operations. And by the
time you do the select, someone may lock the table where you insert. It's a
potential for deadlock.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




В списке pgsql-sql по дате отправления:

Предыдущее
От: "Emils Klotins"
Дата:
Сообщение: Re: [SQL] Getting primary key from insert statement
Следующее
От: Michael J Davis
Дата:
Сообщение: RE: [SQL] Getting primary key from insert statement